Skip to content

Conversation

@Laurynas-Jagutis
Copy link
Member

Related to #994

So far using references, reference wrappers to replace shared_ptr.

@Laurynas-Jagutis Laurynas-Jagutis self-assigned this Jan 5, 2026
@Laurynas-Jagutis Laurynas-Jagutis added the improvement Improvement on internal implementation label Jan 5, 2026
@sonarqubecloud
Copy link

static constexpr auto is_iterative = true;

IterativeCurrentPFSolver(YBus<sym> const& y_bus, std::shared_ptr<MathModelTopology const> const& topo_ptr)
IterativeCurrentPFSolver(YBus<sym> const& y_bus, MathModelTopology const& topo_ptr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is no longer a pointer

Suggested change
IterativeCurrentPFSolver(YBus<sym> const& y_bus, MathModelTopology const& topo_ptr)
IterativeCurrentPFSolver(YBus<sym> const& y_bus, MathModelTopology const& topo)

private:
// cache topology
std::shared_ptr<MathModelTopology const> math_topology_;
MathModelTopology const& math_topology_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

member types should not be const& as it prevents it from being copyable and movable. Instead, please use either a raw pointer const* or a std::reference_wrapper

data_gain_(y_bus.nnz_lu()),
delta_x_rhs_(y_bus.size()),
x_(y_bus.size()),
sparse_solver_{y_bus.shared_indptr_lu(), y_bus.shared_indices_lu(), y_bus.shared_diag_lu()},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i even think we can remove shared_indptr_lu and shared_indices_lu and shared_diag_lu altogether

Comment on lines +475 to +476
auto const& row_indptr = row_indptr_;
auto const& col_indices = col_indices_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may want to use the member version in the rest of the code as well. the utility declaration auto const& was only to remove the need to specify pointer everywhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement on internal implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants